<template>
  <section>
    <userCard
      v-for="(userInfo,index) in listUser"
      :key="index"
      :user-info="userInfo"
    />
    <el-pagination
      class="item-pagination"
      prev-text="上一页"
      next-text="下一页"
      :total="count"
      :page-size="5"
      layout="total, prev, pager, next"
    />
    <!-- :hide-on-single-page="true" -->
    <!-- :disabled="animationDefend" -->
    <!-- :current-page="nowShowTab.page"
      :page-size="nowShowTab.pageSize"
      @current-change="currentChangeHandler" -->
  </section>
</template>

<script>
import userCard from '@/components/userCard/index';
// api
import { getUserList } from '@/api/mivawork/user.js';
export default {
  components: {
    userCard
  },
  data() {
    return {
      count: 0,
      listUser: []
    };
  },
  async mounted() {
    await this.getUserList();
  },
  methods: {
    async getUserList(page = 1) {
      const res = await getUserList({ page, size: 5 });
      this.listUser = res.data.rows;
      this.count = res.data.count;
    }
  }
};
</script>
